|| fileNameRealPath.str() == m_inputFile)
continue;
+#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(21,0,0))
+ auto sourceFile = sourceMgr.getFileManager()
+ .getFileRef(fileNameRealPath);
+ if (!sourceFile)
+ continue;
+ auto sourceLocation = sourceMgr.translateFileLineCol(&sourceFile->getFileEntry(), 1, 1);
+#elif (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(16,0,0))
+ auto sourceFile = sourceMgr.getFileManager()
+ .getOptionalFileRef(fileNameRealPath);
+ if (!sourceFile)
+ continue;
+ auto sourceLocation = sourceMgr.translateFileLineCol(&sourceFile->getFileEntry(), 1, 1);
+#else
auto sourceFile = sourceMgr.getFileManager()
.getFile(fileNameRealPath);
+ if (!sourceFile)
+ continue;
auto sourceLocation = sourceMgr.translateFileLineCol(sourceFile.get(), 1, 1);
+#endif
const clang::FileID fileId = sourceMgr.getDecomposedLoc(sourceLocation).first;
processIsolatedComments(fileId);
}
clang::SourceLocation callLocation(const clang::SourceManager &sourceManager)
{
if (sourceLocation.isInvalid()) {
+#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(21,0,0))
+ auto sourceFile = sourceManager.getFileManager()
+ .getFileRef(lupdateLocationFile.toStdString());
+ if (sourceFile)
+ sourceLocation = sourceManager.translateFileLineCol(&sourceFile->getFileEntry(),
+ lupdateLocationLine, locationCol);
+#elif (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(16,0,0))
+ auto sourceFile = sourceManager.getFileManager()
+ .getOptionalFileRef(lupdateLocationFile.toStdString());
+ if (sourceFile)
+ sourceLocation = sourceManager.translateFileLineCol(&sourceFile->getFileEntry(),
+ lupdateLocationLine, locationCol);
+#else
auto sourceFile = sourceManager.getFileManager()
.getFile(lupdateLocationFile.toStdString());
#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(10,0,0))
- sourceLocation = sourceManager.translateFileLineCol(sourceFile.get(),
- lupdateLocationLine, locationCol);
+ if (sourceFile)
+ sourceLocation = sourceManager.translateFileLineCol(sourceFile.get(),
+ lupdateLocationLine, locationCol);
#else
- sourceLocation = sourceManager.translateFileLineCol(sourceFile, lupdateLocationLine,
- locationCol);
+ if (sourceFile)
+ sourceLocation = sourceManager.translateFileLineCol(sourceFile, lupdateLocationLine,
+ locationCol);
+#endif
#endif
}
return sourceLocation;
#include "clang/AST/DeclarationName.h"
#include "clang/AST/GlobalDecl.h"
#include "clang/AST/Mangle.h"
+#include "clang/Basic/Version.h"
QT_WARNING_POP
// If a fully qualified arg is different from the unqualified arg,
// allocate new type in the AST.
if (MightHaveChanged) {
+#if CLANG_VERSION_MAJOR >= 21
+ QualType QT = Ctx.getTemplateSpecializationType(
+ TST->getTemplateName(), FQArgs, /*CanonicalArgs=*/{},
+ TST->getCanonicalTypeInternal());
+#else
QualType QT = Ctx.getTemplateSpecializationType(
TST->getTemplateName(), FQArgs,
TST->getCanonicalTypeInternal());
+#endif
// getTemplateSpecializationType returns a fully qualified
// version of the specialization itself, so no need to qualify
// it.
// allocate new type in the AST.
if (MightHaveChanged) {
TemplateName TN(TSTDecl->getSpecializedTemplate());
+#if CLANG_VERSION_MAJOR >= 21
+ QualType QT = Ctx.getTemplateSpecializationType(
+ TN, FQArgs, /*CanonicalArgs=*/{},
+ TSTRecord->getCanonicalTypeInternal());
+#else
QualType QT = Ctx.getTemplateSpecializationType(
TN, FQArgs,
TSTRecord->getCanonicalTypeInternal());
+#endif
// getTemplateSpecializationType returns a fully qualified
// version of the specialization itself, so no need to qualify
// it.
Ctx, Scope->getPrefix(), WithGlobalNsPrefix);
case NestedNameSpecifier::Super:
case NestedNameSpecifier::TypeSpec:
- case NestedNameSpecifier::TypeSpecWithTemplate: {
+#if CLANG_VERSION_MAJOR < 21
+ case NestedNameSpecifier::TypeSpecWithTemplate:
+#endif
+ {
const Type *Type = Scope->getAsType();
// Find decl context.
const TagDecl *TD = nullptr;
return NestedNameSpecifier::Create(
Ctx, createOuterNNS(Ctx, TD, FullyQualify, WithGlobalNsPrefix),
- false /*No TemplateKeyword*/, TypePtr);
+#if CLANG_VERSION_MAJOR < 21
+ false /*No TemplateKeyword*/,
+#endif
+ TypePtr);
}
/// Return the fully qualified type, including fully-qualified
Qualifiers Quals = QT.getQualifiers();
// Fully qualify the pointee and class types.
QT = getFullyQualifiedType(QT->getPointeeType(), Ctx, WithGlobalNsPrefix);
+#if CLANG_VERSION_MAJOR >= 21
+ QT = Ctx.getMemberPointerType(QT, MPT->getQualifier(), MPT->getMostRecentCXXRecordDecl());
+#else
QualType Class = getFullyQualifiedType(QualType(MPT->getClass(), 0), Ctx,
WithGlobalNsPrefix);
QT = Ctx.getMemberPointerType(QT, Class.getTypePtr());
+#endif
// Add back the qualifiers.
QT = Ctx.getQualifiedType(QT, Quals);
return QT;